package com.example.demo.day.config.learn.design.observable.x1;

//当前天气情况布告板
public class Condition implements Board, Observer {

    private float mTemperature;
    private float mHumidity;
    private float mPressure;

    @Override
    public void display() {
        System.out.println("温度：" + mTemperature + "，湿度" + mHumidity + "，气压：" + mPressure);
    }

    @Override
    public void onNotify(float temperature, float humidity, float pressure) {
        this.mHumidity = humidity;
        this.mPressure = pressure;
        this.mTemperature = temperature;
        display();;
    }

    @Override
    public String toString() {
        return "Condition{" +
                "mTemperature=" + mTemperature +
                ", mHumidity=" + mHumidity +
                ", mPressure=" + mPressure +
                '}';
    }
}
